# -*- encoding:utf-8 -*-
"""
@作者：jiajun_Tang
@文件名：defect_detail_display.py
@时间：2023/8/19  下午 03:37
@文档说明:
"""

dialog_fault = QMyDialog()
self.dialog_fault.resize(480, 360)
self.dialog_fault.setWindowTitle('瑕疵细节')
self.verticalLayout = QtWidgets.QVBoxLayout(self.dialog_fault)
self.verticalLayout.setObjectName("verticalLayout")

# height, width, channel = defect_img.shape
# qtimg = QtGui.QImage(defect_img.data, width, height, QImage.Format_RGB888)

qpixmapimg = self.cvimg_to_qpixmapimg(defect_img)

self.pic = QPixmap(qpixmapimg)
self.label_pic = QLabel("show", self.dialog_fault)
self.label_pic.setPixmap(self.pic)
self.verticalLayout.addWidget(self.label_pic)

# 瑕疵细节图及属性
self.verticalLayout1 = QtWidgets.QVBoxLayout()
self.verticalLayout1.setObjectName("verticalLayout1")
self.label_20 = QtWidgets.QLabel()
self.label_20.setObjectName("label_20")
self.label_20.setText("缺陷种类及概率：{},  {:.2f} %".format(defect_type, accuracy))
self.verticalLayout1.addWidget(self.label_20)
self.label_21 = QtWidgets.QLabel()
self.label_21.setObjectName("label_21")
self.label_21.setText(f"缺   陷   宽： \t {defect_wide}")
self.verticalLayout1.addWidget(self.label_21)
self.label_22 = QtWidgets.QLabel()
self.label_22.setObjectName("label_22")
self.label_22.setText(f"缺   陷   长： \t {defect_length}")
self.verticalLayout1.addWidget(self.label_22)
self.label_23 = QtWidgets.QLabel()
# self.label_23.setObjectName("label_23")
# self.label_23.setText("缺 陷 面 积： \t XXX")
# self.verticalLayout1.addWidget(self.label_23)

self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_24 = QtWidgets.QLabel()
self.label_24.setObjectName("label_24")
self.label_24.setText("检测是否正确：")
self.horizontalLayout.addWidget(self.label_24)
self.checkBox_21 = QtWidgets.QCheckBox()
self.checkBox_21.setObjectName("checkBox_21")
self.checkBox_21.setText("正确")
self.horizontalLayout.addWidget(self.checkBox_21)
self.checkBox_22 = QtWidgets.QCheckBox()
self.checkBox_22.setObjectName("checkBox_21")
self.checkBox_22.setText("错误")
self.horizontalLayout.addWidget(self.checkBox_22)
self.verticalLayout1.addLayout(self.horizontalLayout)

self.verticalLayout.addLayout(self.verticalLayout1)

self.dialog_fault.exec_()
